import  jsonschema

json_data = {
    "success": True,
    "code": 10000,
    "message": "xxx操作成功",
    "data":{
        "age":20,
        "name":"tom"
    }


}

schema = { "type": "object",
           "properties": {
               "success": { "type": "boolean" },
                "code": { "type": "integer" },
                "message": { "pattern": "操作成功$"  },
                "data":{
                    "type":"object",

                    "properties":{
                        "name":{"const":"tom"},
                        "age":{"const":20}
                                },

                    "required":["name","age"]
                }
           },
            "required": ["success", "code", "message","data"]}



res = jsonschema.validate(instance=json_data, schema=schema)
print("检查结果是：", res)